// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
    const wxContext = cloud.getWXContext()
    const openID=wxContext.OPENID
    const db=cloud.database()
    let dataList = await db.collection('toDo')
    .where({
      _openid:openID
    })
    .get();
    const classify=new Set();
    /*此处待修改，可以用一张userClassify表来简化遍历操作，减少时间消耗*/
    for(var i=0;i<dataList.data.length;i++){
      classify.add(dataList.data[i].classify)
    }
    return Array.from(classify);
}